'use strict';
function getCurrentTime() {
    return new Date();
}
const arr = ['日', '一', '二', '三', '四', '五', '六'];
function format(date) {
    let hours, minutes, seconds, year, month, day;
    hours = date.getHours();
    minutes = date.getMinutes();
    seconds = date.getSeconds();

    year = date.getFullYear();
    month = date.getMonth() + 1;
    day = date.getDate();
    const ymd = `${ year }年${month}月${day}日`;
    const time = `${addZero(hours)}:${addZero(minutes)}:${addZero(seconds)}`;
    return {
        ymd,
        time,
        week: `星期${arr[date.getDay()]}`
    };
}
function addZero(num) {
    return num < 10 ? `0${num}` : num;
}
function start() {
    const date = getCurrentTime();
    return format(date);
}
const time = document.querySelector('#time');
const ymd = document.querySelector('#ymd');
const week = document.querySelector('#week');
function changeView() {
    const st = start();
    time.innerHTML = st.time;
    ymd.innerHTML = st.ymd;
    week.innerHTML = st.week
}
changeView();
tt();
function tt() {
    setTimeout(() => {
        console.log(arguments);
        changeView();
        tt();
    }, 1000);
}
